An exception filter must implement the ExceptionFilter interface and define a catch(exception, host) method. The exception parameter is the thrown object typed by @Catch(). The host parameter is an ArgumentsHost that provides access to the underlying platform request and response objects via switchToHttp(), switchToWs(), or switchToRpc().
exception — the thrown exception object; typed according to the @Catch() decorator argument.
host: ArgumentsHost — provides platform-agnostic access to the request/response context.
host.switchToHttp() — returns an HttpArgumentsHost with getRequest() and getResponse().
host.switchToWs() — used in WebSocket gateways to access the socket client.
host.switchToRpc() — used in microservice message handlers to access the RPC data.
The catch() return type is void — send the response manually via the response object.